//? 每次找新的元素的插入位置
function insert(arr) {
    const len = arr.length;
    for (let i = 1 ; i < len; i++) {
        const temp = arr[i]
        let j = i - 1
        while (j >= 0 && arr[j] > temp) {
            arr[j + 1] = arr[j]
            j --
        }
        arr[j + 1] = temp
    }
    return arr
}

console.log(insert([4, 2, 8, 9, 1, 7, 10, 3, 0, 2]));
